<template>
  <div style="height:450px;width:100%;">
    <div class="table-title">实时人员信息</div>
    <el-table v-loading="loading" height="400" :data="data" size="mini" border>
      <el-table-column show-overflow-tooltip prop="username" label="姓名"/>
      <el-table-column show-overflow-tooltip prop="phone" label="部门">
        <template slot-scope="scope">
          <span>{{ scope.row.phone}}</span>
        </template>
      </el-table-column>
      <el-table-column show-overflow-tooltip prop="dept.name" label="职位"/>
      <el-table-column show-overflow-tooltip prop="job.name" label="事件"/>
      <el-table-column show-overflow-tooltip prop="createTime" label="时间">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
    </el-table>
    <!--分页组件-->
    <el-pagination
      small
      :total="total"
      background
      layout="prev, pager, next,total"
      @current-change="pageChange"/>
  </div>

</template>

<script>
  import initData from '@/mixins/initData'
  import initDict from '@/mixins/initDict'
  import { parseTime } from '@/utils/index'
  export default {
    mixins: [initData, initDict],
    data() {
      return {}
    },
    created(){
      this.$nextTick(() => {
        this.init()
        this.getDict('user_status')
      })
    },
    mounted() {

    },
    methods: {
      parseTime,
      beforeInit() {
        this.url = 'api/users'
        const sort = 'id,desc'
        this.params = { page: this.page, size: this.size, sort: sort}
        return true
      },
    }
  }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
  .table-title {
    text-align: center;
    font-size: 18px;
    padding: 5px 0px 0px 0px;
  }
</style>
